Skip to content

Conversation

@saff-coder
Copy link

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

I have completed all the required tasks and tests

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Your PR's title isn't in the expected format.

Please check the expected title format, and update yours to match.

Reason: Sprint part (Coursework/sprint 3) doesn't match expected format (example: 'Sprint 2', without quotes)

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@saff-coder saff-coder added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 3, 2025
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Your PR's title isn't in the expected format.

Please check the expected title format, and update yours to match.

Reason: Sprint part (Coursework/sprint 3) doesn't match expected format (example: 'Sprint 2', without quotes)

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@saff-coder saff-coder changed the title London | 25-ITP-September |Sophia Mohamed | Coursework/sprint 3 | 2 practice tdd London | 25-ITP-September |Sophia Mohamed |Sprint 3 | 2 practice tdd Nov 3, 2025
Comment on lines 23 to 28
test("should count multiple occurrences of a character", () => {
const str = "aaaaa";
const char = "a";
const count = countChar(str, char);
const Char = "a";
const count = countChar(str,Char);
expect(count).toEqual(5);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also merge this test into the previous test (they both test "multiple occurrences").

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the test

Comment on lines 11 to 23
test("should return '1st' for 1", () => {
expect(getOrdinalNumber(1)).toEqual("1st");
});
test("should return 'th' for 11, 12, 13", () => {
expect(getOrdinalNumber(11)).toBe("11th");
expect(getOrdinalNumber(12)).toBe("12th");
expect(getOrdinalNumber(13)).toBe("13th");
});
test("should return correct ordinal for numbers > 20", () => {
expect(getOrdinalNumber(21)).toBe("21st");
expect(getOrdinalNumber(22)).toBe("22nd");
expect(getOrdinalNumber(23)).toBe("23rd");
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To ensure thorough testing, we need broad scenarios that cover all possible cases.

  • Listing individual values can quickly lead to an unmanageable number of test cases. You can consider generalise the first test to cover all numbers ending in 1 (but not in 11).

  • Creating a category for "11, 12, 13" is good. You can also generalise the test to cover all numbers ending in 11, 12, 13.

  • "All numbers > 20" as one category might be too broad.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More testing scenarios were added

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 8, 2025
@saff-coder saff-coder added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 9, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good. Well done.

Comment on lines +24 to +30
//test("should count multiple occurrences of a character", () => {
// const str = "aaaaa";
//const Char = "a";
//const count = countChar(str,Char);
// expect(count).toEqual(5);
//});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep the code clean, why not delete all unused code?

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Nov 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants